﻿
using Honeywell.DataCollection.Decoding;
using Honeywell.DataCollection.WinCE.Decoding;

namespace OpenNETCF
{
    public class HoneywellDecodeControl : CompatibleDecodeControl
    {
        private DecodeControl m_decoder;

        public HoneywellDecodeControl()
        {
            m_decoder = new DecodeControl();
            m_decoder.DecodeEvent += new DecodeBase.DecodeEventHandler(m_decoder_DecodeEvent);
        }

        void m_decoder_DecodeEvent(object sender, DecodeBase.DecodeEventArgs e)
        {
            var msg = new DecodeMsg(
                e.DecodeResults.pchMessage,
                e.DecodeResults.chCodeID,
                e.DecodeResults.chSymLetter,
                e.DecodeResults.chSymModifier,
                e.DecodeResults.nLength,
                e.DecodeResults.imgIqImageData);
            RaiseDecodeEvent(new DecodeEventArgs(msg));
        }

        public override int AimerTimeout
        {
            get { return m_decoder.AimerTimeout; }
            set { m_decoder.AimerTimeout = value; }
        }

        public override bool AimIDDisplay
        {
            get { return m_decoder.AimIDDisplay; }
            set { m_decoder.AimIDDisplay = value; }
        }

        public override bool AutoLEDs
        {
            get { return m_decoder.AutoLEDs; }
            set { m_decoder.AutoLEDs = value; }
        }

        public override bool AutoScan
        {
            get { return m_decoder.AutoScan; }
            set { m_decoder.AutoScan = value; }
        }

        public override bool CodeIDDisplay
        {
            get { return m_decoder.CodeIDDisplay; }
            set { m_decoder.CodeIDDisplay = value; }
        }

        public override bool ModifierDisplay
        {
            get { return m_decoder.ModifierDisplay; }
            set { m_decoder.ModifierDisplay = value; }
        }

        public override TriggerKeyEnum TriggerKey
        {
            get { return (TriggerKeyEnum)m_decoder.TriggerKey; }
            set { m_decoder.TriggerKey = (Honeywell.DataCollection.WinCE.Decoding.TriggerKeyEnum)value; }
        }

        public override AudioDevice AudioMode
        {
            get { return (AudioDevice)m_decoder.AudioMode; }
            set { m_decoder.AudioMode = (Honeywell.DataCollection.Decoding.AudioDevice) value; }
        }

        public override bool AutoSounds
        {
            get { return m_decoder.AutoSounds; }
            set { m_decoder.AutoSounds = value; }
        }

        public override bool ContinuousScan
        {
            get { return m_decoder.ContinuousScan; }
            set { m_decoder.ContinuousScan = value; }
        }

        public override int DecodeAttemptLimit
        {
            get { return m_decoder.DecodeAttemptLimit; }
            set { m_decoder.DecodeAttemptLimit = value; }
        }

        public override DecodeMode DecodeMode
        {
            get { return (DecodeMode) m_decoder.DecodeMode; }
            set { m_decoder.DecodeMode =  (Honeywell.DataCollection.Decoding.DecodeMode)value; }
        }

        public override ScanLightsMode LightsMode
        {
            get { return  (ScanLightsMode)m_decoder.LightsMode; }
            set { m_decoder.LightsMode = (Honeywell.DataCollection.Decoding.ScanLightsMode) value; }
        }

        public override int LinearRange
        {
            get { return m_decoder.LinearRange; }
            set { m_decoder.LinearRange = value; }
        }

        public override int PrintWeight
        {
            get { return m_decoder.PrintWeight; }
            set { m_decoder.PrintWeight = value; }
        }

        public override int ScanTimeout
        {
            get { return m_decoder.ScanTimeout; }
            set { m_decoder.ScanTimeout = value; }
        }

        public override int SearchTimeLimit
        {
            get { return m_decoder.SearchTimeLimit; }
            set { m_decoder.SearchTimeLimit = value; }
        }

        public override bool TraceMode
        {
            get { return m_decoder.TraceMode; }
            set { m_decoder.TraceMode = value; }
        }

        public override bool VideoReverse
        {
            get { return m_decoder.VideoReverse; }
            set { m_decoder.VideoReverse = value; }
        }

        public override bool VirtualKeyMode
        {
            get { return m_decoder.VirtualKeyMode; }
            set { m_decoder.VirtualKeyMode = value; }
        }

        public override VirtualKeyTermEnum VirtualKeyTerm
        {
            get { return (VirtualKeyTermEnum)m_decoder.VirtualKeyTerm; }
            set { m_decoder.VirtualKeyTerm = (Honeywell.DataCollection.Decoding.VirtualKeyTermEnum)value; }
        }


        public override void CancelScanBarcode()
        {
            m_decoder.CancelScanBarcode();
        }

        public override void Clear()
        {
            m_decoder.Clear();
        }

        public override void ScanBarcode()
        {
            m_decoder.ScanBarcode();
        }

        public override void ScanBarcode(bool bNonBlocking)
        {
            m_decoder.ScanBarcode(bNonBlocking);
        }

        public override bool TriggerKeyIsDown()
        {
            return m_decoder.TriggerKeyIsDown();
        }

        public override void Connect()
        {
            m_decoder.Connect();
        }

        public override void Disconnect()
        {
            m_decoder.Disconnect();
        }

        public override void EnableSymbology(SymID sym, bool enable)
        {
            m_decoder.EnableSymbology((Honeywell.DataCollection.Decoding.SymID)sym, enable);
        }
    }
}
